<?php

/**
 * Credential filter form base class.
 *
 * @package    maximous
 * @subpackage filter
 * @author     Mina.Gerges.Wadea
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseCredentialFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'              => new sfWidgetFormFilterInput(),
      'type'               => new sfWidgetFormFilterInput(),
      'need_category'      => new sfWidgetFormFilterInput(),
      'default_credential' => new sfWidgetFormFilterInput(),
      'editable'           => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'title'              => new sfValidatorPass(array('required' => false)),
      'type'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'need_category'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'default_credential' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'editable'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('credential_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Credential';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'title'              => 'Text',
      'type'               => 'Number',
      'need_category'      => 'Number',
      'default_credential' => 'Number',
      'editable'           => 'Number',
    );
  }
}
